﻿using System;
using System.Data;
using System.Configuration;
using System.Collections.Generic;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

public partial class TaoBaoApi_TB_UploadBB : System.Web.UI.Page
{
    protected void Page_PreInit(object sender, EventArgs e)
    {
        Page.Theme = BLL.Common.GetWSMThemes();
    }
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            new TBCommon().BindTBShop(ddlShop);
            BindSP();
        }
    }
    void BindSP()
    {
        List<Model.SHANGPIN> spArray = new BLL.SHANGPIN().GetAllList();
        gvList.DataSource = spArray;
        gvList.DataBind();
    }
    protected void gvList_PageIndexChanging(object sender, GridViewPageEventArgs e)
    {
        gvList.PageIndex = e.NewPageIndex;
        BindSP();
    }
    protected void gvList_RowCreated(object sender, GridViewRowEventArgs e)
    {
        new TBCommon().gv_RowCreated(sender, e, gvList, Page);
    }
    protected void btnNext_Click(object sender, EventArgs e)
    {
        if (ddlShop.SelectedIndex < 0)
        {
            new TBCommon().ShowMessage(Page, "请选择淘宝店铺。");
            return;
        }
        string user = ddlShop.SelectedItem.Text;
        string spdm= null;
        foreach (GridViewRow row in gvList.Rows)
        {
            CheckBox chk = (CheckBox)row.FindControl("chkOne");
            if (chk != null && chk.Checked)
                spdm = row.Cells[1].Text;
        }
        if (spdm == null)
        {
            new TBCommon().ShowMessage(Page, "请选择一件商品。");
            return;
        }
        Response.Redirect("tb_uploadbb2.aspx?user="+user+"&spdm="+spdm);
    }
}
